/*****************************************************
	
	smws6.h
	Joe Pardue Nov 10, 2008
	Revision: 1.00

	License: 
	This software is not suitable for any purpose whatsoever.
	The moment it is activated, it will destroy any machine
	it is run on and kill all life in a one kilometer radius . 
	Have a nice day!
	
	
	YES, THIS IS A HAIRY MESS OF THINGS BORROWED WILLY NILLY,
    CUT AND PASTED, THROWN IN, AND VARIOIUSLY WASHED UP ON 
	THE BEACH...
	
	CHECK WWW.SMILEYMICROS.COM TO SEE IF THERE IS A LATER
	VERSION. 

******************************************************/

// Prevent duplicate inclusion of this file
#ifndef SMWS6_H
#define SMWS6_H

#include <avr/io.h>
#include <avr/pgmspace.h> 
#include <avr/wdt.h>
#include <avr/interrupt.h>
#include <stdio.h>
#include <stdlib.h>

void initialization(void);

// output string on both LCD and UART
void show(char s[]);

#define LCD_REGISTER_COUNT      20
#define TEXTBUFFER_SIZE         25

void LCD_puts_f(const char *pFlashStr, char scrollmode);

uint8_t uartCount;
char uartString[64];
uint8_t checkUART(void);

#define sendUartRAMString(value) printf(value)

#define show(value) { printf_P(PSTR(value)); LCD_puts_f(PSTR(value), 1); }

// return 0 if no joy, anything else if joy
uint8_t checkJoystick(void);

volatile char joystickInput;
volatile char joystickChanged;

// declare global variables
volatile char KEY;
volatile char KEY_VALID;
volatile char ENABLED;

#define KEY_UP      0
#define KEY_DOWN    1
#define KEY_LEFT    2
#define KEY_RIGHT   3
#define KEY_PUSH    4
#define KEY_INVALID 5

// declare functions
void pinChangeInterrupt(void);
char getkey(void);

void initializer(void);
void parseInput(char *);
void joystick(void);


#endif 
